package com.cbs.android.extension.webviewclient.sample;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

/**
 * Created by broche on 7/30/16.
 */
public class LogActivity extends Activity {
    private TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_log);
        textView = (TextView) findViewById(R.id.logs);

        refresh();
    }

    public void back(View view) {
        finish();
    }

    public void clear(View view) {
        CBSLog.logs.clear();
        refresh();
    }

    private void refresh() {
        StringBuilder stringBuilder = new StringBuilder();
        for (String log : CBSLog.logs) {
            stringBuilder.append(log);
            stringBuilder.append("\n\n");
        }
        textView.setText(stringBuilder.toString());
    }
}
